<?php
class Form_User_Login extends Zend_Form
{
	public function __construct()
	{
		parent::__construct();

		$refer = Zend_Controller_Front::getInstance()->getRequest()->getServer('HTTP_REFERER');
        $ref = new Zend_Form_Element_Hidden('ref');
       // $ref->setValue( $refer ? $refer : Zend_Registry::get('config')->custom->successLoginPage);


        $this->setName('login');

		$email = new Zend_Form_Element_Text('login',array('placeholder' => 'Введите логин') );
		$email->setLabel('Логин')
		      ->setRequired(true)
              ->addFilter('StringTrim')
            //  ->addValidator('EmailAddress')
              ->addValidator('NotEmpty')
              ->addFilter('StripTags')
              //->addValidator('StringLength', true, array(6, 30))
              ;
        $email->addValidator('NotEmpty', true)->setAllowEmpty(false);
        $email->getValidator('NotEmpty')->setMessage('Введите логин');

       // $email->getValidator('EmailAddress')->setMessage($this->_lng->_('fw_enter_u_email_right'),Zend_Validate_EmailAddress::INVALID_FORMAT);

		$password = new Zend_Form_Element_Password('pswd',array( 'placeholder' => 'Введите пароль' ) );
		$password->setLabel('Пароль')
		         ->setRequired(true)
                 ->addFilter('StringTrim')
                 ->addValidator('NotEmpty')
                 ->addFilter('StripTags')
                 //->addValidator('StringLength', true, array(7, 30))
                 ->addValidator('Alnum');
        $password->addValidator('NotEmpty', true)->setAllowEmpty(false);
        $password->getValidator('NotEmpty')->setMessage('Введите пароль');



		$log = new Zend_Form_Element_Submit('send');
        $log->setAttrib('id','login_submit');
		$log->setLabel('Войти');




		$this->addElements(array($email, $password, $log));
		$this->setMethod('post');
		//$this->setAction('/login/index');

	}
 }
